import { http } from '@/utils/http'
import type { BrowseHistoryPageParams, BatchDeleteParams } from './history.d'
import type { GoodsSkuVo } from '@/service/goods/goods.d'

/** 商品浏览历史服务API */
export const GoodsBrowseHistoryApi = {
  /** 添加浏览历史 */
  add(skuId: number) {
    return http<boolean>({
      method: 'GET',
      url: '/goods/browse/history/add',
      query: { skuId },
    })
  },

  /** 批量删除浏览历史 */
  deleteBatch(params: BatchDeleteParams) {
    return http<boolean>({
      method: 'DELETE',
      url: '/goods/browse/history/deleteBatch',
      query: params,
    })
  },

  /** 分页查询浏览历史 */
  getPageList(params: BrowseHistoryPageParams) {
    return http<PageResult<GoodsSkuVo>>({
      method: 'GET',
      url: '/goods/browse/history/list',
      query: params,
    })
  },
}
